/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package gwtroot.My;

import com.google.gwt.user.client.rpc.GwtTransient;

import java.util.Collection;
import java.util.List;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * A representation of the model object '<em><b>Vehicle</b></em>'.
 * <!-- end-user-doc -->
 *
 * <p>
 * The following features are supported:
 * <ul>
 *   <li>{@link gwtroot.My.Vehicle#getWheels <em>Wheels</em>}</li>
 *   <li>{@link gwtroot.My.Vehicle#getVersion <em>Version</em>}</li>
 *   <li>{@link gwtroot.My.Vehicle#getId <em>Id</em>}</li>
 * </ul>
 * </p>
 *
 * @see gwtroot.My.MyPackage#getVehicle()
 * @model kind="class" abstract="true"
 * @generated
 */
public abstract class Vehicle extends EObjectImpl implements EObject {
	/**
	 * The cached value of the '{@link #getWheels() <em>Wheels</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getWheels()
	 * @generated
	 * @ordered
	 */
	@GwtTransient
	protected EList<Vehicle> wheels;

	/**
	 * The default value of the '{@link #getVersion() <em>Version</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getVersion()
	 * @generated
	 * @ordered
	 */
	protected static final Long VERSION_EDEFAULT = null;
	/**
	 * The cached value of the '{@link #getVersion() <em>Version</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getVersion()
	 * @generated
	 * @ordered
	 */
	@GwtTransient
	protected Long version = VERSION_EDEFAULT;
	/**
	 * The default value of the '{@link #getId() <em>Id</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getId()
	 * @generated
	 * @ordered
	 */
	protected static final Long ID_EDEFAULT = null;
	/**
	 * The cached value of the '{@link #getId() <em>Id</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getId()
	 * @generated
	 * @ordered
	 */
	@GwtTransient
	protected Long id = ID_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Vehicle() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return MyPackage.Literals.VEHICLE;
	}

	/**
	 * Returns the value of the '<em><b>Wheels</b></em>' containment reference list.
	 * The list contents are of type {@link gwtroot.My.Vehicle}.
	 * <!-- begin-user-doc -->
	 * <p>
	 * If the meaning of the '<em>Wheels</em>' containment reference list isn't clear,
	 * there really should be more of a description here...
	 * </p>
	 * <!-- end-user-doc -->
	 * @return the value of the '<em>Wheels</em>' containment reference list.
	 * @see gwtroot.My.MyPackage#getVehicle_Wheels()
	 * @model containment="true"
	 * @generated
	 */

	public List<Vehicle> getWheels() {
		if (wheels == null) {
			wheels = new EObjectContainmentEList<Vehicle>(Vehicle.class, this,
					MyPackage.VEHICLE__WHEELS);
		}
		return wheels;
	}

	/**
	 * @generated
	 */
	public void setWheels(List<Vehicle> value) {
		// TUTU
		getWheels().clear();
		getWheels().addAll(value);
	}

	/**
	 * Returns the value of the '<em><b>Version</b></em>' attribute.
	 * <!-- begin-user-doc -->
	 * <p>
	 * If the meaning of the '<em>Version</em>' attribute isn't clear,
	 * there really should be more of a description here...
	 * </p>
	 * <!-- end-user-doc -->
	 * @return the value of the '<em>Version</em>' attribute.
	 * @see #setVersion(Long)
	 * @see gwtroot.My.MyPackage#getVehicle_Version()
	 * @model required="true"
	 * @generated
	 */

	public Long getVersion() {
		return version;
	}

	/**
	 * Sets the value of the '{@link gwtroot.My.Vehicle#getVersion <em>Version</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @param value the new value of the '<em>Version</em>' attribute.
	 * @see #getVersion()
	 * @generated
	 */
	public void setVersion(Long newVersion) {
		Long oldVersion = version;
		version = newVersion;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET,
					MyPackage.VEHICLE__VERSION, oldVersion, version));
	}

	/**
	 * Returns the value of the '<em><b>Id</b></em>' attribute.
	 * <!-- begin-user-doc -->
	 * <p>
	 * If the meaning of the '<em>Id</em>' attribute isn't clear,
	 * there really should be more of a description here...
	 * </p>
	 * <!-- end-user-doc -->
	 * @return the value of the '<em>Id</em>' attribute.
	 * @see #setId(Long)
	 * @see gwtroot.My.MyPackage#getVehicle_Id()
	 * @model
	 * @generated
	 */

	public Long getId() {
		return id;
	}

	/**
	 * Sets the value of the '{@link gwtroot.My.Vehicle#getId <em>Id</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @param value the new value of the '<em>Id</em>' attribute.
	 * @see #getId()
	 * @generated
	 */
	public void setId(Long newId) {
		Long oldId = id;
		id = newId;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET,
					MyPackage.VEHICLE__ID, oldId, id));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd,
			int featureID, NotificationChain msgs) {
		switch (featureID) {
		case MyPackage.VEHICLE__WHEELS:
			return ((InternalEList<?>) getWheels()).basicRemove(otherEnd, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
		case MyPackage.VEHICLE__WHEELS:
			return getWheels();
		case MyPackage.VEHICLE__VERSION:
			return getVersion();
		case MyPackage.VEHICLE__ID:
			return getId();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
		case MyPackage.VEHICLE__WHEELS:
			getWheels().clear();
			getWheels().addAll((Collection<? extends Vehicle>) newValue);
			return;
		case MyPackage.VEHICLE__VERSION:
			setVersion((Long) newValue);
			return;
		case MyPackage.VEHICLE__ID:
			setId((Long) newValue);
			return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
		case MyPackage.VEHICLE__WHEELS:
			getWheels().clear();
			return;
		case MyPackage.VEHICLE__VERSION:
			setVersion(VERSION_EDEFAULT);
			return;
		case MyPackage.VEHICLE__ID:
			setId(ID_EDEFAULT);
			return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
		case MyPackage.VEHICLE__WHEELS:
			return wheels != null && !wheels.isEmpty();
		case MyPackage.VEHICLE__VERSION:
			return VERSION_EDEFAULT == null ? version != null
					: !VERSION_EDEFAULT.equals(version);
		case MyPackage.VEHICLE__ID:
			return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id);
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy())
			return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (version: ");
		result.append(version);
		result.append(", id: ");
		result.append(id);
		result.append(')');
		return result.toString();
	}

	/**
	 @generated
	 */
	public static Vehicle findVehicle(Long id) {
		return null;
	}
} // Vehicle
